# import os
# os.add_dll_directory("C://Users//bendizhanghu//.mujoco//mjpro150//bin")
# os.add_dll_directory("C://Users//bendizhanghu//.mujoco//mujoco-py-1.50.1.0//mujoco_py")

# import mujoco_py
# mj_path, _ = mujoco_py.utils.discover_mujoco()
# xml_path = os.path.join(mj_path, 'model', 'humanoid.xml')
# model = mujoco_py.load_model_from_path(xml_path)
# sim = mujoco_py.MjSim(model)
# print(sim.data.qpos)
# sim.step()
# print(sim.data.qpos)

# import gym
# env = gym.make('HalfCheetah-v2')
# env.reset()
# done = False
# while not done:
#     _, _, done, _ = env.step(env.action_space.sample())
#     env.render()
# env.close()







# import numpy as np
# cost_eps = np.zeros((5, 1), dtype=np.float32)
# cost_eps1 = cost_eps
# cost_eps = np.ones((5, 1), dtype=np.float32)
# print(cost_eps)
# print(cost_eps1)




# for t in reversed(range(10)):
#     print('t = ', t)







'''下面是绘制结果的代码'''
# import pickle
# import matplotlib.pyplot as plt

# f = open(r".\focops_results\focops_velocity_Humanoid-v3_hyperparams_seed_0.pkl",'rb')
# hyperparams = pickle.load(f)
# print(hyperparams)
# f = open(r".\focops_results\focops_velocity_Humanoid-v3_log_data_seed_0.pkl",'rb')
# log_data = pickle.load(f)
# # print(log_data)
# # print(hyperparams['env_id'])
# # hhhhhhhhh


# # self.log_data = {'time': 0,
# #                  'MinR': [],
# #                  'MaxR': [],
# #                  'AvgR': [],
# #                  'MinC': [],
# #                  'MaxC': [],
# #                  'AvgC': [],
# #                  'nu': [],
# #                  'running_stat': None}

# def plot_result(result_data, plot_what, hyperparams, name_method):
#     plt.figure()
#     plt.plot(list(range(len(result_data))), result_data)
#     # plt.plot(list(range(len(result_data))), result_data, label=f'{name_method} (non-smoothed)')
#     # result_data_mv = rl_utils.moving_average(result_data, 100)
#     # result_data_mv = rl_utils.smooth(result_data, weight=0.9)
#     # plt.plot(list(range(len(result_data_mv))), result_data_mv, label=f'{name_method} (smoothed)')
#     plt.xlabel('Number of Main Iterations')
#     plt.ylabel(plot_what)
#     env_id = hyperparams['env_id']
#     plt.title(f'{name_method} on {env_id} (Training)')
#     plt.legend(loc='best')
#     plt.grid()
#     plt.show()


# plot_what = 'AvgR'
# plot_result(log_data[plot_what], plot_what, hyperparams, hyperparams["algo"])
# plot_what = 'AvgC'
# plot_result(log_data[plot_what], plot_what, hyperparams, hyperparams["algo"])